package com.community.property.domain;

import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.community.common.annotation.Excel;
import com.community.common.core.domain.BaseEntity;

/**
 * 报修管理对象 repair
 *
 * @author ruoyi
 * @date 2025-10-27
 */
@JsonIgnoreProperties(ignoreUnknown = true) // 忽略未知字段
public class Repair extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 报修ID
     */
    private Integer repairId;

    /**
     * 社区ID
     */
    @Excel(name = "社区ID")
    private Integer communityId;


    /**
     * 房屋ID
     */
    @Excel(name = "楼宇ID")
    private Integer buildingId;

    /**
     * 报修类型
     */
    @Excel(name = "报修类型")
    private String repairType;

    /**
     * 报修房间号
     */
    @Excel(name = "报修房间号")
    private String roomNo;

    /**
     * 报修人
     */
    @Excel(name = "报修人")
    private String reporter;

    /**
     * 报修人电话
     */
    @Excel(name = "报修人电话")
    private String reporterPhone;

    /**
     * 报修时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "报修时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date reportTime;

    /**
     * 报修描述
     */
    @Excel(name = "报修描述")
    private String description;

    /**
     * 图片(JSON数组)
     */
    @Excel(name = "图片(JSON数组)")
    private String images;

    /**
     * 状态(待分配/处理中/已完成/已关闭)
     */
    @Excel(name = "状态(待分配/处理中/已完成/已关闭)")
    private Integer status;

    /**
     * 处理人
     */
    @Excel(name = "处理人")
    private Integer handlerId;

    /**
     * 处理时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "处理时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date handleTime;

    /**
     * 处理描述
     */
    @Excel(name = "处理描述")
    private String handleDescription;

    /**
     * 优先级
     */
    @Excel(name = "优先级")
    private String priority;

    /**
     * 预计完成时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "预计完成时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date estimatedTime;

    /**
     * 实际完成时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "实际完成时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date actualTime;

    /**
     * 费用
     */
    @Excel(name = "费用")
    private Double fee;

    private String communityName;


    private String buildingName;

    private String workName;
    /**
     * 是否付费
     */
    @Excel(name = "是否付费")
    private Integer isPaid;

    public String getCommunityName() {
        return communityName;
    }

    public void setCommunityName(String communityName) {
        this.communityName = communityName;
    }

    public String getBuildingName() {
        return buildingName;
    }

    public void setBuildingName(String buildingName) {
        this.buildingName = buildingName;
    }

    public Integer getRepairId() {
        return repairId;
    }

    public void setRepairId(Integer repairId) {
        this.repairId = repairId;
    }

    public Integer getCommunityId() {
        return communityId;
    }

    public void setCommunityId(Integer communityId) {
        this.communityId = communityId;
    }

    public Integer setBuildingId(Integer buildingId) {
        this.buildingId = buildingId;
        return buildingId;
    }

    public Integer getBuildingId() {
        return buildingId;
    }

    public String getRepairType() {
        return repairType;
    }

    public void setRepairType(String repairType) {
        this.repairType = repairType;

    }

    public String getRoomNo() {
        return roomNo;
    }

    public void setRoomNo(String roomNo) {
        this.roomNo = roomNo;
    }

    public String getReporter() {
        return reporter;
    }

    public void setReporter(String reporter) {
        this.reporter = reporter;
    }

    public String getReporterPhone() {
        return reporterPhone;
    }

    public void setReporterPhone(String reporterPhone) {
        this.reporterPhone = reporterPhone;
    }

    public Date getReportTime() {
        return reportTime;
    }

    public void setReportTime(Date reportTime) {
        this.reportTime = reportTime;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getImages() {
        return images;
    }

    public void setImages(Object images) {
        if (images == null) {
            this.images = null;
        } else if (images instanceof String) {
            this.images = (String) images;
        } else {
            // 如果是对象或数组，转换为JSON字符串
            try {
                ObjectMapper objectMapper = new ObjectMapper();
                this.images = objectMapper.writeValueAsString(images);
            } catch (JsonProcessingException e) {
                // 如果转换失败，设置为null或空字符串
                this.images = null;
            }
        }
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getHandlerId() {
        return handlerId;
    }

    public void setHandlerId(Integer handlerId) {
        this.handlerId = handlerId;
    }

    public String getWorkName() {
        return workName;
    }

    public void setWorkName(String workName) {
        this.workName = workName;
    }

    public Date getHandleTime() {
        return handleTime;
    }

    public void setHandleTime(Date handleTime) {
        this.handleTime = handleTime;
    }

    public String getHandleDescription() {
        return handleDescription;
    }

    public void setHandleDescription(String handleDescription) {
        this.handleDescription = handleDescription;
    }

    public String getPriority() {
        return priority;
    }

    public void setPriority(String priority) {
        this.priority = priority;
    }

    public Date getEstimatedTime() {
        return estimatedTime;
    }

    public void setEstimatedTime(Date estimatedTime) {
        this.estimatedTime = estimatedTime;
    }

    public Date getActualTime() {
        return actualTime;
    }

    public void setActualTime(Date actualTime) {
        this.actualTime = actualTime;
    }

    public Double getFee() {
        return fee;
    }

    public void setFee(Double fee) {
        this.fee = fee;
    }

    public Integer getIsPaid() {
        return isPaid;
    }

    public void setIsPaid(Integer isPaid) {
        this.isPaid = isPaid;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("repairId", getRepairId())
                .append("communityId", getCommunityId())
                .append("buildingId", getBuildingId())
                .append("repairType", getRepairType())
                .append("roomNo", getRoomNo())
                .append("reporter", getReporter())
                .append("reporterPhone", getReporterPhone())
                .append("reportTime", getReportTime())
                .append("description", getDescription())
                .append("images", getImages())
                .append("status", getStatus())
                .append("handlerId", getHandlerId())
                .append("workName", getWorkName())
                .append("handleTime", getHandleTime())
                .append("handleDescription", getHandleDescription())
                .append("priority", getPriority())
                .append("estimatedTime", getEstimatedTime())
                .append("actualTime", getActualTime())
                .append("fee", getFee())
                .append("isPaid", getIsPaid())
                .append("createTime", getCreateTime())
                .append("updateTime", getUpdateTime())
                .append("buildingName", getBuildingName())
                .append("communityName", getCommunityName())

                .toString();
    }

}
